package com.example.tsproject.mapper;

import com.example.tsproject.entity.Answers;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
* @author 86183
* @description 针对表【answers】的数据库操作Mapper
* @createDate 2025-03-11 20:25:22
* @Entity com.example.tsproject.entity.Answers
*/
@Mapper
public interface AnswersMapper extends BaseMapper<Answers> {

        void insertOrUpdateAnswer(@Param("assignmentId") Integer assignmentId,
                                  @Param("questionId") Integer questionId,
                                  @Param("userAnswer") String userAnswer,
                                  @Param("stuNum") String stuNum,
                                  @Param("trueOrfalse") String trueOrfalse);
//        @Select(
//                "SELECT a.* " +
//                        "FROM answers a " +
//                        "WHERE a.assignment_id IN (" +
//                        "    SELECT id " +
//                        "    FROM assignments " +
//                        "    WHERE publisher_number = #{tNumber} " +
//                        "    AND class_number = #{classNumber} " +
//                        "    AND name = #{name}" +
//                        ")")
        List<Answers> getAnswersListWithStudentNameByClass(@Param("tNumber") String tNumber, @Param("classNumber") String classNumber, @Param("name") String name);
}




